package com.xudu.xianrendongculturaltravelbackend.controller;

import com.qcloud.cos.demo.ci.ImageSearchDemo;
import com.xudu.xianrendongculturaltravelbackend.common.BaseResponse;
import com.xudu.xianrendongculturaltravelbackend.common.ResultUtils;
import com.xudu.xianrendongculturaltravelbackend.exception.ErrorCode;
import com.xudu.xianrendongculturaltravelbackend.exception.ThrowUtils;
import com.xudu.xianrendongculturaltravelbackend.manager.FileManager;
import com.xudu.xianrendongculturaltravelbackend.model.dto.scenic.ScenicAddRequest;
import com.xudu.xianrendongculturaltravelbackend.service.ScenicService;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.annotation.Resource;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import java.awt.*;
import java.util.List;

@RestController
@RequestMapping("/")
public class MainController {

    @Resource
    private FileManager fileManager;

    /**
     * 健康检查
     */
    @GetMapping("/health")
    public BaseResponse<String> health() {
        class user {
            public String name = "xudu";
            public int age = 18;
        }
        user s = new user();

        ThrowUtils.throwIf(s == null, ErrorCode.SYSTEM_ERROR, "系统异常");
        return ResultUtils.success("ok");
    }

    @PostMapping(value = "/upload")
    public BaseResponse<String> upload(AddTest addTest) {
        String scenicName = addTest.getScenicName();
        ThrowUtils.throwIf(scenicName == null, ErrorCode.PARAMS_ERROR);
        //fileManager.uploadPicture( file, scenicName);
        //fileManager.uploadPicture( addTest.getScenicImages().get(0), scenicName);

        return ResultUtils.success("ok");
    }
}